﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using DiscoveryLogic.Common.Utilities;

namespace DiscoveryLogic.Analytics.DataObjects.Rules
{
    public abstract class RuleBase
    {
        private string _RuleName;
        /// <summary></summary>
        public string RuleName
        {
            get
            {
                return this._RuleName;
            }
            set
            {
                this._RuleName = value;
            }
        }

        private RuleType _RuleType;
        /// <summary></summary>
        public RuleType RuleType
        {
            get
            {
                return this._RuleType;
            }
            set
            {
                this._RuleType = value;
            }
        }

        private SetDataSourceType _SrcDataFormat;
        /// <summary></summary>
        public SetDataSourceType SrcDataFormat
        {
            get
            {
                return this._SrcDataFormat;
            }
            set
            {
                this._SrcDataFormat = value;
            }
        }

        private EntityType _SrcEntityType;
        /// <summary></summary>
        public EntityType SrcEntityType
        {
            get
            {
                return this._SrcEntityType;
            }
            set
            {
                this._SrcEntityType = value;
            }
        }

        private EntityType _TgtEntityType;
        /// <summary></summary>
        public EntityType TgtEntityType
        {
            get
            {
                return this._TgtEntityType;
            }
            set
            {
                this._TgtEntityType = value;
            }
        }

        private string _IconPath;
        /// <summary></summary>
        public string IconPath
        {
            get
            {
                return this._IconPath;
            }
            set
            {
                this._IconPath = value;
            }
        }

        public RuleBase(
            string ruleName, RuleType ruleType, 
            SetDataSourceType srcDataFormat, 
            EntityType srcEntityType, EntityType tgtEntityType,
            string iconPath)
        {
            this._RuleName = ruleName;
            this._RuleType = ruleType;
            this._IconPath = iconPath;
            this._SrcDataFormat = srcDataFormat;
            this._SrcEntityType = srcEntityType;
            this._TgtEntityType = tgtEntityType;
        }

        public abstract void Save(ref XmlDocument xDoc, XmlNode ruleNode);
        public abstract RuleBase Read(XmlNode ruleNode);
    }
}
